double ReturnNum(double x, long long n)
{
    if(n == 0)
        return 1.0;

    double num = ReturnNum(x, n / 2);
    return n % 2 == 0 ? num * num : x * num * num;
}

double myPow(double x, int n)
{
    long long N = n;
    return N >= 0 ? ReturnNum(x, N) : 1.0 / ReturnNum(x, -N);
}